package org.bleep.util;

import org.lwjgl.opengl.GL11;
import org.lwjgl.util.vector.Vector2f;

import org.bleep.geom.Rectangle;

public class DrawingUtils
{
	public static void drawRectangle(Rectangle bounds, Color color, boolean filled)
	{
		drawBox(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), color, filled);
	}
	
	public static void drawBox(float x, float y, float w, float h, Color color, boolean filled)
	{
		GL11.glDisable(GL11.GL_TEXTURE_2D);
		// GL11.glDisable(GL11.GL_LIGHTING);

		GL11.glPushMatrix();
		GL11.glTranslatef((int)(x + 0.5f), (int)(y + 0.5f), 1.999f);
		color.glColor();

		if (filled)
		{
			GL11.glBegin(GL11.GL_QUADS);
		}
		else
		{
			GL11.glBegin(GL11.GL_LINE_LOOP);
		}
		GL11.glVertex3f(0, 0, 0); // bottom-left
		GL11.glVertex3f(0, h, 0); // top-left
		GL11.glVertex3f(w, h, 0); // top-right
		GL11.glVertex3f(w, 0, 0); // bottom-right	
		GL11.glEnd();

		GL11.glPopMatrix();

		// GL11.glEnable(GL11.GL_LIGHTING);
		GL11.glEnable(GL11.GL_TEXTURE_2D);	
	}
}